/*
 * Copyright (c) 2006, 2022, webrx.cn All rights reserved.
 *
 */
package cn.webrx;

import java.util.Calendar;

/**
 * <p>Project: jse2204 - Ex3
 * <p>Powered by webrx On 2022-08-29 17:33:44
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class Ex3 {
    public static void main(String[] args) {
        //根据时间显示相关的问候 早上好 上午好 ....
        Calendar c = Calendar.getInstance();
        //int hour = c.get(Calendar.HOUR);
        //System.out.println(hour);5
        //int hour = c.get(Calendar.HOUR_OF_DAY);
        int hour = c.get(Calendar.HOUR_OF_DAY); //24 0-23
        System.out.println(hour);//17时
        //14 - 18 下午
        if (hour >= 14 && hour < 18) {
            System.out.println("下午好");
        } else if (hour >= 18 && hour <= 23) {
            System.out.println("晚上好");
        } else if (hour >= 0 && hour < 2) {
            System.out.println("夜深了，请尽快休息");
        } else if (hour >= 2 && hour < 6) {
            System.out.println("凌晨，请注意身体");
        } else if (hour >= 6 && hour < 8) {
            System.out.println("早上好");
        } else {
            System.out.println("上午好");
        }
    }
}
